//go:generate goagen bootstrap -d git.oschina.net/antlinker/antevent/server/design

package main

import (
	"log"
	"os"

	"git.oschina.net/antlinker/antevent/server/debug"
	"gopkg.in/urfave/cli.v2"
)

func pprof(c *cli.Context) {
	pprofaddr := c.String("pprof")
	if pprofaddr != "" {
		debug.StartHTTPPprof(pprofaddr)
	}
}
func main() {

	app := &cli.App{
		Authors: []*cli.Author{
			{Name: "@antlinker.com"},
		},
		Name:    "事件引擎工具",
		Version: "1.0",
		Usage:   "事件调度引擎测试工具",
		Commands: []*cli.Command{
			&cli.Command{
				Name:    "consumer",
				Aliases: []string{"cons"},
				Usage:   "启动事件消费者服务",
				Flags:   createStart(),
				Action:  initcons,
			},
			&cli.Command{
				Name:    "producer",
				Aliases: []string{"prod"},
				Usage:   "发送一个事件",
				Flags:   createProd(),
				Action:  initProd,
			},
		},
	}

	err := app.Run(os.Args)
	if err != nil {
		log.Println("启动失败:", err)
	}

}
